<template>
  <div class="container">
    <el-row type="flex" justify="space-between">
      <!-- 订单表单 -->
      <div class="main">
        <OrderForm
          v-if="flightInfo.insurances"
          :data="flightInfo"
          @getPrice="dealPrice"
        />
      </div>

      <!-- 侧边栏 -->
      <div class="aside">
        <OrderAside
          v-if="flightInfo.insurances"
          :data="flightInfo"
          :totalPrice="price"
        />
      </div>
    </el-row>
  </div>
</template>

<script>
import OrderForm from "@/components/air/orderForm.vue";
import OrderAside from "@/components/air/orderAside.vue";
export default {
  data() {
    return {
      flightInfo: {},
    };
  },
  components: {
    OrderForm,
    OrderAside,
  },
  mounted() {
    let { id, seat_xid } = this.$route.query;
    // JiPiao - 选择机票 http:127.0.0.1:1337/airs/:id
    this.$axios({
      url: `/airs/${id}`,
      params: { seat_xid },
    }).then((res) => {
      console.log(res);
      this.flightInfo = res.data;
    });
  },
};
</script>

<style lang="less" scoped>
.container {
  width: 1000px;
  margin: 20px auto;
}

/*aside*/
.aside {
  width: 350px;
  height: fit-content;
  border: 1px #ddd solid;
}
</style>